package com.jspgou.cms.dao.impl;

import org.hibernate.Criteria;
import org.springframework.stereotype.Repository;

import com.jspgou.common.hibernate3.HibernateBaseDao;
import com.jspgou.common.page.Pagination;
import com.jspgou.cms.dao.StoreExtDao;
import com.jspgou.cms.entity.StoreExt;

@Repository
public class StoreExtDaoImpl extends HibernateBaseDao<StoreExt, Long> implements StoreExtDao {
	public Pagination getPage(int pageNo, int pageSize) {
		Criteria crit = createCriteria();
		Pagination page = findByCriteria(crit, pageNo, pageSize);
		return page;
	}
	
	public StoreExt getByStorename(String storeName){
		return (StoreExt)findUniqueByProperty("storeName", storeName);
	}

	public StoreExt findById(Long id) {
		StoreExt entity = get(id);
		return entity;
	}

	public StoreExt save(StoreExt bean) {
		getSession().save(bean);
		return bean;
	}

	public StoreExt deleteById(Long id) {
		StoreExt entity = super.get(id);
		if (entity != null) {
			getSession().delete(entity);
		}
		return entity;
	}
	
	@Override
	protected Class<StoreExt> getEntityClass() {
		return StoreExt.class;
	}
}